package com.briup.product_source.util;

import com.briup.product_source.exception.CustomerException;

public abstract class Assert {
    public static void hasText(String str,ResultCode rc){
        if(str == null || "".equals(str.trim())){
            throw new CustomerException(rc);
        }
    }
    public static void isNull(Object obj,ResultCode rc){
        if(obj == null){
            throw new CustomerException(rc);
        }
    }

    public static void notNull(Object obj,ResultCode rc){
        if(obj != null){
            throw new CustomerException(rc);
        }
    }

    public static void isTrue(boolean flag,ResultCode rc){
        if(!flag){
            throw new CustomerException(rc);
        }
    }

}
